﻿<%@ WebHandler Language="C#" Class="DeleteAttachmentsDnd" %>

using System;
using System.Web;
using System.IO;
using CRMBiz;
using CRMWeb.Utilities.Context;

public class DeleteAttachmentsDnd : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        try
        {
            context.Response.ContentType = "text/plain";
            string UploadFiles = context.Request.Params["UploadFiles"];
            string foldername = HttpContext.Current.Server.MapPath("~/Webservices/upload/");
            string FilePath = foldername + UploadFiles;
            System.IO.FileInfo FName = new System.IO.FileInfo(FilePath);
            decimal s1 = FName.Length;
            decimal size = s1 / 1000;
            System.IO.File.Delete(foldername + "\\" + UploadFiles);
        }
        catch (Exception ex)
        {
            ErrorHandler.saveErrorLog(ex,CMSContext.CurrentUser.MemberName);
        }
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}